var express = require("express");
var router = express.Router();
const Result = require("../utils/result");
const topicService = require("../services/topicService");

//获取话题列表，按分类进行获取
router.get('/list',async function(req,res){
    const {  category,knowLedgeList } = await topicService.getList();
    res.json(Result.success({category,knowLedgeList}));
});

//获取话题详情
router.get('/detail',async function(req,res){
    const { id,userId } = req.query;
    const topic = await topicService.getDetail(id,userId);
    res.json(Result.success({topic}));
})

module.exports = router;